package cn._2dland.bots.jdo.models;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Account {
	/** 激活状态 */
	public static final int STATUS_ACTIVE = 0;
	/** 停用状态 */
	public static final int STATUS_INACTIVE = 1;
	/** 出错状态 */
	public static final int STATUS_ERROR = 2;

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	/** 用户名 */
	@Persistent
	private String username;

	/** 密码 */
	@Persistent
	private String password;

	/** 帐号状态 */
	@Persistent
	private int status;

	/** 上次活动时间 */
	@Persistent
	private long lastTime;
	
	public Account(String username, String password) {
		super();
		this.username = username;
		this.password = password;
		this.status = STATUS_ACTIVE;
		this.lastTime = 0;
	}

	public Long getID() {
		return id;
	}

	public String getUsername() {
		return username;
	}

	public String getPassword() {
		return password;
	}

	public int getStatus() {
		return status;
	}

	public long getLastTime() {
		return lastTime;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public void setLastTime(long lastTime) {
		this.lastTime = lastTime;
	}
}